﻿using System;
using Xunit;

namespace TestXunit
{
    public sealed class TestAsserts
    {
        [Fact]
        public void TestInRange()
        {
            Assert.InRange(8, 6, 9);
            Assert.InRange(new DateTime(2008, 1, 1), new DateTime(2000, 1, 1), new DateTime(2009, 1, 6));
        }

        [Fact]
        public void TestSame()
        {
            var str1 = "Stasi";
            var str2 = "Stasi";
            var str3 = "s".ToUpper() + "tasi";

            Assert.Same(str1,str2);
            Assert.NotSame(str1,str3);
            Assert.Equal(str1, str3);
        }

        [Fact]
        public void TestType()
        {
            var ex = new InvalidOperationException();
            Assert.IsType(typeof(InvalidOperationException),ex);
            Assert.IsType<InvalidOperationException>(ex);

            // note: exact type, not derived type
            Assert.True(ex is Exception);
            Assert.IsNotType<Exception>(ex);
        }
    }
}
